package com.tushare.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tushare.entity.StkHolderNumber;
import com.tushare.mapper.StkHolderNumberMapper;
import com.tushare.service.IStkHolderNumberService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author jobob
 * @since 2021-03-13
 */
@Service
public class StkHolderNumberServiceImpl extends ServiceImpl<StkHolderNumberMapper, StkHolderNumber> implements IStkHolderNumberService {

    @Override
    public List<StkHolderNumber> getStkHolderNumberByTsCode(String ts_code, int end_date) {
        return getBaseMapper().getStkHolderNumberByTsCode(ts_code, end_date);
    }

    @Override
    public List<StkHolderNumber> getHighStock(int begin_date, int end_date) {
        return getBaseMapper().getHighStock(begin_date, end_date);
    }

    @Override
    public boolean saveStkHolderNumbers(List<StkHolderNumber> list) {
        if (list == null) {
            return false;
        }
        if (list.size() == 0) {
            return true;
        }
        return getBaseMapper().saveOrUpdateBatch(list);
    }

    @Override
    public boolean deleteAllStkHolderNumber() {
        return getBaseMapper().deleteAllStkHolderNumber();
    }
}
